//@ts-nocheck
import React, {
  FC,
  Key,
  ReactNode,
  useEffect,
  useLayoutEffect,
  useMemo,
  useRef,
  useState,
} from "react";
import {
  Button,
  Popconfirm,
  Select,
  SelectProps,
  Space,
  Spin,
  Table,
  TableProps,
} from "antd";

import { getTempData } from "@ey-utils/utils/services/get-temp-data";
import { uuidv4 } from "@ey-utils/utils/utils";
import TablePagination from "@/biz-components/pagination/table";
// import TablePagination from '../../pagination/src';
import { handleSelectProps } from "@ey-utils/utils/utils";

import { useImmer } from "use-immer";
import { isFunction, isObject, isString, merge } from "lodash";

import warning from "warning";

import template from "es6-template-strings";
import { ApiConfig, DynamicObjectAny } from "@ey-utils/utils/typings";
import { formatMessage } from "@ey-utils/utils/i18n";
// import { useIntl } from 'react-intl';
import { arrayToNestJson, toArray } from "@ey-utils/utils/utils";
import { useField, useForm } from "@formily/react";
import { CloseOutlined, DownOutlined } from "@ant-design/icons";
const TEMPLATE_REG_EXP = /\${[0-9.A-Za-z]*}/;
const SYSTEM_KEYBORDER_CODE = ['8', '9', '12', '13', '16', '17', '18', '27']
export interface SelectTableProps<V = any>
    extends Omit<SelectProps<any>, "onChange">,
        Required<Pick<TableProps<any>, "columns">> {
  changeKey?: string; //
  valueTemplateKey?: string;
  labelTemplateKey?: string;
  clearPopConfirm?: boolean;
  showSearchAll?: boolean;
  keywordKey?: string;
  onChange: (value: V, record: any) => void;
  rowKey?: string;
  editable?: boolean;
  api: ApiConfig;
  tableCheckboxProps?: (record: any) => DynamicObjectAny;
  tableRowSelection?: () => TableProps<any>["rowSelection"];
  onChangeRecord: (value: any) => void;
  renderTableCell?: {
    [key: string]: (
        text: any,
        record: DynamicObjectAny,
        rowIndex: number
    ) => ReactNode;
  };
  enabledExactQuery?: boolean;
  exactQueryParamKey?: string;
  convertExactQueryParam?: (codes: string[]) => DynamicObjectAny;
  onChangeValue?: boolean;
  exactQueryParamsArray?: boolean;
  allowClear?: boolean;
  footRender?: () => DynamicObjectAny;
  footerStyle?: Object;
}

export const SelectTable: FC<SelectTableProps> = ({
                                                    changeKey,
                                                    valueTemplateKey,
                                                    labelTemplateKey,
                                                    clearPopConfirm,
                                                    disabled,
                                                    showSearchAll,
                                                    columns,
                                                    showSearch,
                                                    keywordKey,
                                                    onChange,
                                                    value,
                                                    rowKey,
                                                    editable,
                                                    api,
                                                    mode,
                                                    maxTagCount,
                                                    preserveSelectedRowKeys = false,
                                                    tableCheckboxProps,
                                                    tableRowSelection,
                                                    renderTableCell,
                                                    onChangeRecord,
                                                    placeholder,
                                                    enabledExactQuery,
                                                    exactQueryParamKey,
                                                    convertExactQueryParam,
                                                    onChangeValue,
                                                    exactQueryParamsArray,
                                                    allowClear = true,
                                                    valueToUpperCase = false, //输入值转大写
                                                    footRender,
                                                    footerStyle = {},
                                                    delAll,
                                                    ...restProps
                                                  }) => {
  const { method, url } = api || {};

  warning(Array.isArray(columns), "请配置 表格 列 columns");

  // const { formatMessage } = useIntl();
  let form: any = null;
  try {
    form = useForm();
  } catch (e) { }

  let field: any = null;
  try {
    field = useField();
  } catch (e) { }
  const isMultiple = useMemo(() => {
    return mode ? ["multiple", "tags"].includes(mode) : false;
  }, [mode]);

  const [loading, setLoading] = useState(false);
  //输入框是否处于合成事件中
  const [composition, setComposition] = useState(false);
  const inputRef = useRef(null)
  const [isExactSearch, setIsExactSearch] = useState(false);
  const [selectValue, setSelectValue] = useState<any[]>([]);

  const [isSearch, setIsSearch] = useState(false);

  const [dataSource, setDataSource] = useState<any[]>(
      restProps?.dataSource || []
  );

  const [likeSearch, setLikeSearch] = useState<boolean>(false);

  const [selectedRowKeys, setSelectedRowKeys] = useState<Key[]>([]);

  const [dropdownVisible, setDropdownVisible] = useState<boolean>(false);

  const [scrollX, setScrollX] = useState("100%");
  const [placement, setPlacement] = useState("bottomLeft"); // 框位置
  const [sectionOptionMinWidth, setSectionOptionMinWidth] = useState(0); // 框位置

  const [paginationConfig, updatePaginationConfig] = useImmer({
    current: 1,
    pageSize: 10,
    total: 0,
  });

  const selectRef = useRef<any>(undefined);
  const containerRef = useRef<any>(undefined);

  const { current, pageSize, total } = paginationConfig;

  const [keyword, setKeyword] = useState<string | undefined>(undefined);
  const [keywordCache, setKeywordCache] = useState<string | undefined>(
      undefined
  );


  const transformValue = (val: any) => {
    return isObject(val) && changeKey ? val[changeKey] : val;
  };

  const triggerChange = (changedValue: any) => {
    const values =
        Array.isArray(changedValue) && isMultiple
            ? changedValue.map((item) => {
              return transformValue(item);
            })
            : transformValue(changedValue);

    onChangeRecord?.(changedValue);
    onChange?.(values, changedValue, uuidv4());

    // 冗余数据
    if (!Array.isArray(values)) {
      if (restProps?.context?.type === "NORMAL" && form && field) {
        // 处理 codeName
        if (field.parent.displayName === "ArrayField") {
          const newPath = [...field.path.segments];
          newPath.pop();
          // 处理targeyKey
          const targetKey: any[] = restProps?.targetKey || [];
          const targetKeyMap: any = restProps?.targetKeyMap || {};
          targetKey.forEach((k: any) => {
            const ddd = [...newPath, k];
            form.setValuesIn(
                ddd.join("."),
                changedValue?.[targetKeyMap[k] || k]
            );
          });
        } else {
          const key = field?.props?.name;
          const labelProp = restProps?.optionLabelProp || "label";
          form.setValuesIn(key + "Name", changedValue?.[labelProp]);
          // 处理targeyKey
          const targetKey: any[] = restProps?.targetKey || [];
          const targetKeyMap: any = restProps?.targetKeyMap || {};
          targetKey.forEach((k: any) => {
            form.setValuesIn(k, changedValue?.[targetKeyMap[k] || k]);
          });
        }
      }
    }
  };

  const mergeParams = (
      path: any,
      value: any,
      params: DynamicObjectAny
  ): DynamicObjectAny => {
    if (Array.isArray(path) || path.indexOf(".") > -1) {
      const keywordKeyPath = Array.isArray(path)
          ? path
          : path?.split(".") || [];

      warning(
          keywordKeyPath.length,
          `${path} 非字符串或者是空字符串无法设置搜索请设置`
      );

      return merge(arrayToNestJson(keywordKeyPath, value), params);
    }
    return path
        ? {
          [path]: value,
          ...params,
        }
        : {};
  };

  const generateParams = (payload?: any) => {
    const { params } = api || { params: {} };
    return {
      ...mergeParams(keywordKey, payload ? keywordCache?.trim() : keyword?.trim(), params),
      pageSize,
      pageNo: current,
    };
  };

  const transformData = (data: any[]): any[] => {
    return data.map((item: any) => {
      const { name, code } = item;

      const isLabelTemplateString = TEMPLATE_REG_EXP.test(
          labelTemplateKey || ""
      );
      const isValueTemplateString = TEMPLATE_REG_EXP.test(
          valueTemplateKey || ""
      );

      let newLabel = labelTemplateKey ? item[labelTemplateKey] : name;
      let newValue = valueTemplateKey ? item[valueTemplateKey] : code;

      if (isLabelTemplateString) {
        newLabel = template(labelTemplateKey, item);
      }

      if (isValueTemplateString) {
        newValue = template(valueTemplateKey, item);
      }

      return {
        ...item,
        label: newLabel,
        value: newValue,
      };
    });
  };

  // 精准查询
  const exactSearch = (codes: string[], triggerOnChange?: boolean) => {
    if (!url) return;

    let queryParamKey = exactQueryParamKey;

    if (triggerOnChange && !exactQueryParamKey) {
      queryParamKey = keywordKey;
    }

    if (!(enabledExactQuery || triggerOnChange) || !queryParamKey) {
      setIsExactSearch(true);
      return;
    }

    const { params } = api || { params: {} };

    const exactParams =
        convertExactQueryParam?.(codes) ||
        mergeParams(
            queryParamKey,
            exactQueryParamsArray ? codes : codes[0],
            merge(
                params,
                triggerOnChange
                    ? {
                      queryKeys: {
                        MATCH_EQ: true,
                      },
                    }
                    : {}
            )
        );

    getTempData({
      type: method,
      url,
      params: {
        pageSize: codes.length,
        pageNo: 1,
        ...exactParams,
      },
    }).then((res: any) => {
      const { content, totalElements } = res;

      const data = transformData(content);

      const newSelectValue = selectValue.concat(
          data.filter((item) => {
            return !selectValue.find((current) => current.value === item.value);
          })
      );

      setSelectValue(newSelectValue);

      if (!dataSource.length) {
        setDataSource(newSelectValue);
      }
      updatePaginationConfig((draft) => {
        draft.total = totalElements;
      });
      setIsExactSearch(true);

      setSelectedRowKeys(value);

      if (triggerOnChange && data.length) {
        handleChange(isMultiple ? data : data[0]);
      }
    });
  };

  /***
   * 模糊匹配
   */
  const search = (payload?: any) => {
    if (!editable) return;

    if (!url) return;

    const params = generateParams(payload);

    setLoading(true);
    getTempData({
      type: method,
      url,
      params,
    })
        .then((res: any) => {
          setLoading(false);
          const { content, totalElements } = res;

          setDataSource(transformData(content));

          setIsSearch(false);

          updatePaginationConfig((draft) => {
            draft.total = totalElements;
          });
        })
        .catch(() => {
          setLoading(false);
        });
  };
  const handleSearch = (val) => {
    if (valueToUpperCase && !composition) {
      setKeyword((val + "").toUpperCase())
      setKeywordCache(old => {
        if (inputRef.current) {
          inputRef.current.oldValue = old || ''
        }
        return val.toUpperCase()
      })
    } else {
      setKeyword(val)
      setKeywordCache(val)
    }
  }

  const handleSearchClick = () => {
    setLikeSearch(true);
    updatePaginationConfig((draft) => {
      draft.current = 1;
    });

    if (current === 1) {
      search(keywordCache);
    }
  };

  const handleAllSearchClick = () => {
    setKeyword(undefined);

    setIsSearch(true);

    updatePaginationConfig((draft) => {
      draft.current = 1;
    });
  };

  const handlePaginationChange = (
      nextCurrent: number,
      nextPageSize: number
  ) => {
    setIsSearch(true);
    updatePaginationConfig((draft) => {
      draft.current = nextCurrent;
      draft.pageSize = nextPageSize;
    });
  };

  useLayoutEffect(() => {
    if (!containerRef.current) return;

    const tableColumnsWidth = columns?.reduce((accumulation, current) => {
      return accumulation + Number(current?.width || 120);
    }, 0);

    if (tableColumnsWidth > containerRef.current.clientWidth) {
      setScrollX(`${tableColumnsWidth}px`);
    }
  }, [columns, containerRef]);
  const attachEvent = (e: any, events: string[], listeners: any) => {
    if (e
        && Array.isArray(events)
        && Array.isArray(listeners)
        && events.length <= listeners.length
    ) {
      events.forEach((event: string, index: number) => {
        e.target.removeEventListener(event, listeners[index])
        e.target.addEventListener(event, listeners[index])
      })
    }
  }
  const handleFocus = (e) => {
    attachEvent(e
        , ['compositionstart', 'compositionend']
        , [e => setComposition(true), e => {
          setComposition(false)
          const dataFunc = data => {
            let finalValue = ''
            if (e.target.value) {
              finalValue = (e.target.value + '')
            } else {
              finalValue = (e.data || "")
            }
            if (inputRef.current) {
              inputRef.current.oldValue = data || ''
            }
            return valueToUpperCase ? finalValue.toUpperCase() : finalValue
          }
          setKeyword(dataFunc)
          setKeywordCache(dataFunc)
        }]
    )
    if (value && !isMultiple) {
      setTimeout(() => {
        setKeywordCache(value);
      }, 100);
    }
    let domOffect = e.target?.getBoundingClientRect();
    const selectWidth = domOffect.width + 40;
    let selectOptionWidth = columns.length * 150;
    let offsetLeft = domOffect.left - 11;
    let offsetRight = window.innerWidth - domOffect.left - domOffect.width - 29;
    if (offsetRight + selectWidth >= selectOptionWidth) {
      setPlacement("bottomLeft");
    } else if (offsetLeft + selectWidth >= selectOptionWidth) {
      setPlacement("bottomRight");
    } else {
      if (offsetRight < offsetLeft) {
        selectOptionWidth = offsetLeft + selectWidth;
        setPlacement("bottomRight");
      } else {
        selectOptionWidth = offsetRight + selectWidth;
        setPlacement("bottomLeft");
      }
    }
    setSectionOptionMinWidth(selectOptionWidth);

    if (!dataSource.length || (!value && likeSearch)) {
      setIsSearch(true);
      setLikeSearch(false);
    }
  };

  useEffect(() => {
    if (!isMultiple) {
      setKeywordCache(value);
    }
  }, [value]);


  useEffect(() => {
    if (!dropdownVisible) return;

    if (restProps?.dataSource && Array.isArray(restProps?.dataSource)) {
      if (isMultiple) {
        const vals =
            (value || [])?.map((col) => {
              return {
                [valueTemplateKey]: col,
                value: col,
              };
            }) || [];
        setSelectValue(vals);
        setSelectedRowKeys(vals.map((col) => col.value));
      }
    }
    if (isSearch) {
      search();
    }
  }, [dropdownVisible, current, pageSize, isSearch]);

  useEffect(() => {
    setDataSource([]);
    setSelectedRowKeys([]);
  }, [JSON.stringify(api)]);

  useEffect(() => {
    if (restProps?.dataSource && Array.isArray(restProps?.dataSource)) {
      setDataSource(transformData(restProps?.dataSource));
    } else {
      setDataSource([]);
    }
    setSelectedRowKeys([]);
  }, [JSON.stringify(restProps?.dataSource)])

  const handleDropdownVisibleChange = (open: boolean) => {
    if (!open && !preserveSelectedRowKeys) {
      setSelectedRowKeys([]);
    }

    setDropdownVisible(open);
  };

  const handleRow = (record: any) => {
    return {
      onClick: () => {
        if (isMultiple) return;
        setSelectValue([record]);

        triggerChange(record);
        selectRef.current?.blur();
        setTimeout(() => {
          setKeywordCache(record[changeKey]);
        }, 100);
      },
    };
  };

  const handleChange = (value: any) => {
    if (isMultiple) {
      setSelectedRowKeys(value.map((item: any) => item.value));
      triggerChange(
          value
              .map((item: any) => {
                return selectValue.find((current) =>
                    isValueEqual(transformValue(current), item)
                );
              })
              .filter((val: any) => val)
      );
    } else {
      triggerChange(value);
    }
  };

  const clearIcon = ({ agreeClear }) => {

    return <Popconfirm
        title={"确认删除删除"}
        onConfirm={agreeClear}
        placement="bottomLeft"
        // onCancel={cancel}
        okText={"是"}
        cancelText={"否"}
    >
      <CloseOutlined />
    </Popconfirm>;
  }

  const tableProps: TableProps<any> = {};

  const rowSelectionProps = tableRowSelection?.() || {};

  const isValueEqual = (
      val: DynamicObjectAny | string,
      newVal: DynamicObjectAny | string
  ): boolean => {
    if (isString(val) && isString(newVal)) {
      return val === newVal;
    }

    if (isObject(val) && isObject(newVal)) {
      return val.value === newVal.value;
    }

    if (isString(val) && isObject(newVal)) {
      return val === newVal.value;
    }

    if (isObject(val) && isString(newVal)) {
      return val.value === newVal;
    }

    return false;
  };

  const rowSelection: TableProps<any>["rowSelection"] = {
    selectedRowKeys,
    preserveSelectedRowKeys,
    onChange: (rowKeyss: Key[], selectedRows: any[]) => {
      const [...oldValue] = value || [];

      const allDataSourceKey = dataSource.map((item) => item.value);

      setSelectValue(
          selectedRows
              .concat(
                  selectValue.filter((item: any) => {
                    return !selectedRows.find((current) =>
                        isValueEqual(transformValue(current), transformValue(item))
                    );
                  })
              )
              .filter((val) => val)
      );

      const mapValue = oldValue
          .map((val: any) => {
            return selectValue.find((item) =>
                isValueEqual(transformValue(item), transformValue(val))
            );
          })
          .filter((val: any) => val);

      const changeValue = mapValue
          .filter((item: any) => !allDataSourceKey.includes(item.value))
          .concat(
              selectedRows.filter((item) => {
                return item && allDataSourceKey.includes(item.value);
              })
          );

      triggerChange(changeValue);

      setSelectedRowKeys(changeValue.map((item: any) => item.value));

      rowSelectionProps?.onChange?.(rowKeyss, selectedRows);
    },
    ...rowSelectionProps,
  };

  if (isFunction(tableCheckboxProps)) {
    rowSelection.getCheckboxProps = tableCheckboxProps;
  }

  if (isMultiple) {
    tableProps.rowSelection = rowSelection;
  } else {
    tableProps.onRow = handleRow;
  }
  const isMES = localStorage.getItem("sysCode") === "MES";
  /**
   * 处理清空业务
   */
  const handlebatchDel = () => {
    triggerChange([]);
  };
  const dropdownRender = (originNode) => {
    if (!dropdownVisible) {
      return undefined;
    }
    console.log('whx tesot');
    return (
        <Spin spinning={loading}>
          <div className="select-table-container" ref={containerRef}>
            {showSearch ? (
                <Space>
                  {delAll ? <Button
                      style={{ marginLeft: "10px" }}
                      // size="small"
                      type="primary"
                      onClick={handlebatchDel}
                  >
                    清空
                  </Button> : null}
                  <Button
                      style={{ marginLeft: "10px" }}
                      // size="small"
                      type="primary"
                      onClick={handleSearchClick}
                  >
                    {formatMessage({
                      id: "select.table.btn.search",
                    })}
                  </Button>
                  {showSearchAll ? (
                      <Button
                          // size="small"
                          type={isMES ? "default" : '"primary"'}
                          onClick={handleAllSearchClick}
                      >
                        {formatMessage({
                          id: isMES
                              ? "重置"
                              : "搜索",
                        })}
                      </Button>
                  ) : null}
                </Space>
            ) : null}

            <Table
                rowKey={rowKey || "value"}
                dataSource={dataSource}
                locale={
                  { emptyText: "无数据" }
                }
                columns={
                  columns?.map((item) => {
                    // @ts-ignore
                    const { dataIndex, title, width } = item;

                    return {
                      ...item,
                      title: formatMessage({
                        id: (title as string) || "default.columns.title",
                      }),
                      ellipsis: true,
                      width: width ?? 100,
                      render: (
                          text: any,
                          record: DynamicObjectAny,
                          rowIndex: number
                      ) => {
                        if (renderTableCell?.[dataIndex]) {
                          return renderTableCell[dataIndex](text, record, rowIndex);
                        }
                        return text;
                      },
                    };
                  }) || []
                }
                size="small"
                pagination={false}
                {...tableProps}
                scroll={{
                  y: 156,
                  x: scrollX,
                }}
            />
            <div style={footerStyle}>
              {footRender && footRender()}
              {
                showSearch &&
                <TablePagination
                    current={current}
                    pageSize={pageSize}
                    total={total}
                    onChange={handlePaginationChange}
                    pageSizeOptions={["5", "10", "20"]}
                />
              }
            </div>
          </div>
        </Spin>
    );
  };

  useEffect(() => {
    setIsExactSearch(false);
  }, [value]);

  useEffect(() => {
    // 多选时，初始化数据未设置selectValue会导致删除某个选项时会清空全部选项
    if (isMultiple) {
      const vals =
          (value || [])?.map((col) => {
            return {
              [valueTemplateKey]: col,
              value: col,
            };
          }) || [];
      setSelectValue(vals);
      setSelectedRowKeys(vals.map((col) => col.value));
    }
  }, [value]);
  useLayoutEffect(() => {
    //回填光标位置
    if (inputRef.current
        && valueToUpperCase
        && !composition //位于组合事件中，不触发
    ) {
      const { start, input, oldValue } = inputRef.current
      //值长度相同时不触发移动光标（compositionend会出现值相同的情况）
      if ((keywordCache || '').length === (oldValue || '').length) return
      const newPos = start + (keywordCache?.length - (oldValue || '').length)
      input?.setSelectionRange && input?.setSelectionRange(
          newPos,
          newPos,
      )
      inputRef.current.start = newPos
    }
  }, [keywordCache, valueToUpperCase, inputRef, composition])

  const displayValue = useMemo(() => {
    if (!value) return value;
    const mapValue = toArray(value).map((val: string) => {
      const record = selectValue.find((item) =>
          isValueEqual(transformValue(item), transformValue(val))
      );
      return record || val;
    });

    if (!isExactSearch) {
      const codes = mapValue.filter((item: any) => isString(item));
      if (codes.length) {
        exactSearch(codes, onChangeValue);
      }
    }

    if (isMultiple && changeKey) {
      return mapValue.map((item: any) => {
        if (isString(item)) {
          return {
            value: item,
            label: item,
          };
        }
        return item;
      });
    }

    return value;
  }, [value, changeKey, selectValue, isExactSearch, onChangeValue]);

  if (!editable) {
    return <span>{value}</span>;
  }
  const handleDown = (val) => {
    if (val.keyCode == 13) {
      handleSearchClick();
    }
  };
  const handleClick = (e) => {
    inputRef.current = {
      input: e.target,
      start: e.target.selectionStart,
    }
  }
  return (
      <>
        {
          clearPopConfirm ?
              <Select
                  dropdownStyle={{
                    minWidth: sectionOptionMinWidth,
                  }}
                  // open
                  {...handleSelectProps(restProps)}
                  mode={mode}
                  maxTagCount={isMultiple ? maxTagCount || "responsive" : null}
                  style={{ width: "100%" }}
                  disabled={disabled}
                  dropdownRender={dropdownRender}
                  // allowClear={allowClear}
                  showSearch={showSearch}
                  searchValue={keywordCache}
                  onSearch={handleSearch}
                  onKeyDown={handleDown}
                  onClick={handleClick}
                  onFocus={handleFocus}
                  placement={placement}
                  options={selectValue}
                  value={displayValue}
                  onChange={handleChange}
                  suffixIcon={displayValue ? clearIcon({
                    agreeClear: () => {
                      form.setValuesIn(labelTemplateKey, "");
                      form.setValuesIn(valueTemplateKey, "");
                    }
                  }) : <DownOutlined />}
                  onDropdownVisibleChange={handleDropdownVisibleChange}
                  ref={selectRef}
                  labelInValue={isMultiple}
                  placeholder={
                    placeholder
                        ? formatMessage({
                          id: (placeholder as string) || "select.table.default.placeholder",
                        })
                        : undefined
                  }
              />
              :
              <Select
                  dropdownStyle={{
                    minWidth: sectionOptionMinWidth,
                  }}
                  // open
                  {...handleSelectProps(restProps)}
                  mode={mode}
                  maxTagCount={isMultiple ? maxTagCount || "responsive" : null}
                  style={{ width: "100%" }}
                  disabled={disabled}
                  dropdownRender={dropdownRender}
                  allowClear={allowClear}
                  showSearch={showSearch}
                  searchValue={keywordCache}
                  onSearch={handleSearch}
                  onKeyDown={handleDown}
                  onClick={handleClick}
                  onFocus={handleFocus}
                  placement={placement}
                  options={selectValue}
                  value={displayValue}
                  onChange={handleChange}
                  onDropdownVisibleChange={handleDropdownVisibleChange}
                  ref={selectRef}
                  labelInValue={isMultiple}
                  placeholder={
                    placeholder
                        ? formatMessage({
                          id: (placeholder as string) || "select.table.default.placeholder",
                        })
                        : undefined
                  }
              />
        }
      </>
  );
};

//      dropdownStyle={{
//         minWidth: 200,
//       }}

SelectTable.defaultProps = {
  optionLabelProp: "label",
  showSearch: true,
  showSearchAll: true,
  exactQueryParamsArray: true,
  editable: true,
  changeKey: "code",
  keywordKey: "value",
  valueTemplateKey: "code",
  labelTemplateKey: "name",
  enabledExactQuery: false,
  exactQueryParamKey: "codes",
  onChangeValue: false,
  clearPopConfirm: false,
  footRender: null,
};

export default SelectTable;
